// src/api/permissionControl.js
import request from '@/utils/request'

// 获取权限树
export function getPermissionTree() {
    return request({
        url: '/permission/tree',
        method: 'get'
    })
}

// 获取所有权限列表
export function getAllPermissions() {
    return request({
        url: '/permission/list',
        method: 'get'
    })
}

// 添加权限
export function addPermission(permissionData) {
    return request({
        url: '/permission',
        method: 'post',
        data: permissionData
    })
}

// 更新权限
export function updatePermission(id, permissionData) {
    return request({
        url: `/permission/${id}`,
        method: 'put',
        data: permissionData
    })
}

// 删除权限
export function deletePermission(id) {
    return request({
        url: `/permission/${id}`,
        method: 'delete'
    })
}